package cn.codergege.packagename.controller;

import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.codergege.packagename.model.Employee;
import cn.codergege.packagename.service.EmployeeService;

@Controller
@RequestMapping("/ajax")
public class AjaxHandler {
	final Logger log = LoggerFactory.getLogger(AjaxHandler.class);
	@Resource
	private EmployeeService employeeService;

	@RequestMapping("test")
	@ResponseBody
	public Object testAjax() {
		int[] nums = {1, 2, 3, 4};
		
		return nums;
	}
	
	@RequestMapping("/employees")
	@ResponseBody
	public Object getEmployees() {
		List<Employee> employees = employeeService.getAll();
		return employees;
	}
}
